//
//  UIWebView+GQAdd.m
//  GQCategorys
//
//  Created by 走出趣_甄冠卿 on 2018/8/15.
//  Copyright © 2018年 zhenguanqing. All rights reserved.
//

#import "UIWebView+GQAdd.h"
#import "NSString+GQAdd.h"

@implementation UIWebView (GQAdd)

- (void)setCustomUserAgentWithString:(NSString *)string {
    NSString *oldAgent = [self stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
    if (![oldAgent isHaveString:string]) {
        NSString *newAgent = [oldAgent stringByAppendingString:[NSString stringWithFormat:@" %@",string]];
        NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:newAgent,@"UserAgent", nil];
        [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
    }
}


@end
